home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_guile.idb / usr / freeware / info / r5rs.info-3.z / r5rs.info-3
Text File  |  2002-07-08  |  47KB  |  1,181 lines

  1. This is r5rs.info, produced by makeinfo version 4.0b from r5rs.texi.
  2.  
  3. INFO-DIR-SECTION The Algorithmic Language Scheme
  4. START-INFO-DIR-ENTRY
  5. * R5RS: (r5rs).                 The Revised(5) Report on Scheme.
  6. END-INFO-DIR-ENTRY
  7.  
  8. 20 February 1998
  9.  
  10. 
  11. File: r5rs.info,  Node: Implementation restrictions,  Next: Syntax of numerical constants,  Prev: Exactness,  Up: Numbers
  12.  
  13. Implementation restrictions
  14. ---------------------------
  15.  
  16. Implementations of Scheme are not required to implement the whole tower
  17. of subtypes given in section *Note Numerical types::, but they must
  18. implement a coherent subset consistent with both the purposes of the
  19. implementation and the spirit of the Scheme language.  For example, an
  20. implementation in which all numbers are real may still be quite useful.
  21.  
  22. Implementations may also support only a limited range of numbers of any
  23. type, subject to the requirements of this section.  The supported range
  24. for exact numbers of any type may be different from the supported range
  25. for inexact numbers of that type.  For example, an implementation that
  26. uses flonums to represent all its inexact real numbers may support a
  27. practically unbounded range of exact integers and rationals while
  28. limiting the range of inexact reals (and therefore the range of inexact
  29. integers and rationals) to the dynamic range of the flonum format.
  30. Furthermore the gaps between the representable inexact integers and
  31. rationals are likely to be very large in such an implementation as the
  32. limits of this range are approached.
  33.  
  34. An implementation of Scheme must support exact integers throughout the
  35. range of numbers that may be used for indexes of lists, vectors, and
  36. strings or that may result from computing the length of a list, vector,
  37. or string.  The `length', `vector-length', and `string-length'
  38. procedures must return an exact integer, and it is an error to use
  39. anything but an exact integer as an index.  Furthermore any integer
  40. constant within the index range, if expressed by an exact integer
  41. syntax, will indeed be read as an exact integer, regardless of any
  42. implementation restrictions that may apply outside this range.
  43. Finally, the procedures listed below will always return an exact
  44. integer result provided all their arguments are exact integers and the
  45. mathematically expected result is representable as an exact integer
  46. within the implementation:
  47.  
  48.  
  49.      +            -             *
  50.      quotient     remainder     modulo
  51.      max          min           abs
  52.      numerator    denominator   gcd
  53.      lcm          floor         ceiling
  54.      truncate     round         rationalize
  55.      expt
  56.  
  57. Implementations are encouraged, but not required, to support exact
  58. integers and exact rationals of practically unlimited size and
  59. precision, and to implement the above procedures and the `/' procedure
  60. in such a way that they always return exact results when given exact
  61. arguments.  If one of these procedures is unable to deliver an exact
  62. result when given exact arguments, then it may either report a
  63. violation of an implementation restriction or it may silently coerce
  64. its result to an inexact number.  Such a coercion may cause an error
  65. later.
  66.  
  67. An implementation may use floating point and other approximate
  68. representation strategies for inexact numbers.
  69.  
  70. This report recommends, but does not require, that the IEEE 32-bit and
  71. 64-bit floating point standards be followed by implementations that use
  72. flonum representations, and that implementations using other
  73. representations should match or exceed the precision achievable using
  74. these floating point standards [IEEE].
  75.  
  76. In particular, implementations that use flonum representations must
  77. follow these rules: A flonum result must be represented with at least
  78. as much precision as is used to express any of the inexact arguments to
  79. that operation.  It is desirable (but not required) for potentially
  80. inexact operations such as `sqrt', when applied to exact arguments, to
  81. produce exact answers whenever possible (for example the square root of
  82. an exact 4 ought to be an exact 2).  If, however, an exact number is
  83. operated upon so as to produce an inexact result (as by `sqrt'), and if
  84. the result is represented as a flonum, then the most precise flonum
  85. format available must be used; but if the result is represented in some
  86. other way then the representation must have at least as much precision
  87. as the most precise flonum format available.
  88.  
  89. Although Scheme allows a variety of written notations for numbers, any
  90. particular implementation may support only some of them.  For example,
  91. an implementation in which all numbers are real need not support the
  92. rectangular and polar notations for complex numbers.  If an
  93. implementation encounters an exact numerical constant that it cannot
  94. represent as an exact number, then it may either report a violation of
  95. an implementation restriction or it may silently represent the constant
  96. by an inexact number.
  97.  
  98. 
  99. File: r5rs.info,  Node: Syntax of numerical constants,  Next: Numerical operations,  Prev: Implementation restrictions,  Up: Numbers
  100.  
  101. Syntax of numerical constants
  102. -----------------------------
  103.  
  104. The syntax of the written representations for numbers is described
  105. formally in section *Note Lexical structure::.  Note that case is not
  106. significant in numerical constants.
  107.  
  108. A number may be written in binary, octal, decimal, or hexadecimal by
  109. the use of a radix prefix.  The radix prefixes are `#b' (binary), `#o'
  110. (octal), `#d' (decimal), and `#x' (hexadecimal).  With no radix prefix,
  111. a number is assumed to be expressed in decimal.
  112.  
  113. A numerical constant may be specified to be either exact or inexact by
  114. a prefix.  The prefixes are `#e' for exact, and `#i' for inexact.  An
  115. exactness prefix may appear before or after any radix prefix that is
  116. used.  If the written representation of a number has no exactness
  117. prefix, the constant may be either inexact or exact.  It is inexact if
  118. it contains a decimal point, an exponent, or a "#" character in the
  119. place of a digit, otherwise it is exact.
  120.  
  121. In systems with inexact numbers of varying precisions it may be useful
  122. to specify the precision of a constant.  For this purpose, numerical
  123. constants may be written with an exponent marker that indicates the
  124. desired precision of the inexact representation.  The letters `s', `f',
  125. `d', and `l' specify the use of SHORT, SINGLE, DOUBLE, and LONG
  126. precision, respectively.  (When fewer than four internal inexact
  127. representations exist, the four size specifications are mapped onto
  128. those available.  For example, an implementation with two internal
  129. representations may map short and single together and long and double
  130. together.)  In addition, the exponent marker `e' specifies the default
  131. precision for the implementation.  The default precision has at least
  132. as much precision as DOUBLE, but implementations may wish to allow this
  133. default to be set by the user.
  134.  
  135.  
  136.      3.14159265358979F0
  137.             Round to single -- 3.141593
  138.      0.6L0
  139.             Extend to long -- .600000000000000
  140.  
  141. 
  142. File: r5rs.info,  Node: Numerical operations,  Next: Numerical input and output,  Prev: Syntax of numerical constants,  Up: Numbers
  143.  
  144. Numerical operations
  145. --------------------
  146.  
  147. The reader is referred to section *Note Entry format:: for a summary of
  148. the naming conventions used to specify restrictions on the types of
  149. arguments to numerical routines.
  150.  
  151. The examples used in this section assume that any numerical constant
  152. written using an exact notation is indeed represented as an exact
  153. number.  Some examples also assume that certain numerical constants
  154. written using an inexact notation can be represented without loss of
  155. accuracy; the inexact constants were chosen so that this is likely to
  156. be true in implementations that use flonums to represent inexact
  157. numbers.
  158.  
  159.  - procedure: number? obj
  160.  - procedure: complex? obj
  161.  - procedure: real? obj
  162.  - procedure: rational? obj
  163.  - procedure: integer? obj
  164.      These numerical type predicates can be applied to any kind of
  165.      argument, including non-numbers.  They return #t if the object is
  166.      of the named type, and otherwise they return #f.  In general, if a
  167.      type predicate is true of a number then all higher type predicates
  168.      are also true of that number.  Consequently, if a type predicate
  169.      is false of a number, then all lower type predicates are also
  170.      false of that number.
  171.  
  172.      If Z is an inexact complex number, then `(real? Z)' is true if and
  173.      only if `(zero? (imag-part Z))' is true.  If X is an inexact real
  174.      number, then `(integer? X)' is true if and only if `(= X (round
  175.      X))'.
  176.  
  177.      (complex? 3+4i)                        ==>  #t
  178.      (complex? 3)                           ==>  #t
  179.      (real? 3)                              ==>  #t
  180.      (real? -2.5+0.0i)                      ==>  #t
  181.      (real? #e1e10)                         ==>  #t
  182.      (rational? 6/10)                       ==>  #t
  183.      (rational? 6/3)                        ==>  #t
  184.      (integer? 3+0i)                        ==>  #t
  185.      (integer? 3.0)                         ==>  #t
  186.      (integer? 8/4)                         ==>  #t
  187.  
  188.           _Note:_ The behavior of these type predicates on inexact
  189.           numbers is unreliable, since any inaccuracy may affect the
  190.           result.
  191.  
  192.           _Note:_ In many implementations the `rational?' procedure
  193.           will be the same as `real?', and the `complex?' procedure
  194.           will be the same as `number?', but unusual implementations
  195.           may be able to represent some irrational numbers exactly or
  196.           may extend the number system to support some kind of
  197.           non-complex numbers.
  198.  
  199.  
  200.  - procedure: exact? Z
  201.  - procedure: inexact? Z
  202.      These numerical predicates provide tests for the exactness of a
  203.      quantity.  For any Scheme number, precisely one of these predicates
  204.      is true.
  205.  
  206.  
  207.  - procedure: = z1 z2 z3 ...,
  208.  - procedure: < x1 x2 x3 ...,
  209.  - procedure: > x1 x2 x3 ...,
  210.  - procedure: <= x1 x2 x3 ...,
  211.  - procedure: >= x1 x2 x3 ...,
  212.      These procedures return #t if their arguments are (respectively):
  213.      equal, monotonically increasing, monotonically decreasing,
  214.      monotonically nondecreasing, or monotonically nonincreasing.
  215.  
  216.      These predicates are required to be transitive.
  217.  
  218.           _Note:_ The traditional implementations of these predicates
  219.           in Lisp-like languages are not transitive.
  220.  
  221.           _Note:_ While it is not an error to compare inexact numbers
  222.           using these predicates, the results may be unreliable because
  223.           a small inaccuracy may affect the result; this is especially
  224.           true of `=' and `zero?'.  When in doubt, consult a numerical
  225.           analyst.
  226.  
  227.  
  228.  - library procedure: zero? Z
  229.  - library procedure: positive? X
  230.  - library procedure: negative? X
  231.  - library procedure: odd? N
  232.  - library procedure: even? N
  233.      These numerical predicates test a number for a particular property,
  234.      returning #t or #f.  See note above.
  235.  
  236.  
  237.  - library procedure: max x1 x2 ...,
  238.  - library procedure: min x1 x2 ...,
  239.      These procedures return the maximum or minimum of their arguments.
  240.  
  241.      (max 3 4)                              ==>  4    ; exact
  242.      (max 3.9 4)                            ==>  4.0  ; inexact
  243.  
  244.           _Note:_ If any argument is inexact, then the result will also
  245.           be inexact (unless the procedure can prove that the
  246.           inaccuracy is not large enough to affect the result, which is
  247.           possible only in unusual implementations).  If `min' or `max'
  248.           is used to compare numbers of mixed exactness, and the
  249.           numerical value of the result cannot be represented as an
  250.           inexact number without loss of accuracy, then the procedure
  251.           may report a violation of an implementation restriction.
  252.  
  253.  
  254.  - procedure: + z1 ...,
  255.  - procedure: * z1 ...,
  256.      These procedures return the sum or product of their arguments.
  257.  
  258.      (+ 3 4)                                ==>  7
  259.      (+ 3)                                  ==>  3
  260.      (+)                                    ==>  0
  261.      (* 4)                                  ==>  4
  262.      (*)                                    ==>  1
  263.  
  264.  
  265.  - procedure: - z1 z2
  266.  - procedure: - Z
  267.  - optional procedure: - z1 z2 ...,
  268.  - procedure: / z1 z2
  269.  - procedure: / Z
  270.  - optional procedure: / z1 z2 ...,
  271.      With two or more arguments, these procedures return the difference
  272.      or quotient of their arguments, associating to the left.  With one
  273.      argument, however, they return the additive or multiplicative
  274.      inverse of their argument.
  275.  
  276.      (- 3 4)                                ==>  -1
  277.      (- 3 4 5)                              ==>  -6
  278.      (- 3)                                  ==>  -3
  279.      (/ 3 4 5)                              ==>  3/20
  280.      (/ 3)                                  ==>  1/3
  281.  
  282.  
  283.  - library procedure: abs x
  284.      `Abs' returns the absolute value of its argument.
  285.  
  286.      (abs -7)                               ==>  7
  287.  
  288.  
  289.  - procedure: quotient n1 n2
  290.  - procedure: remainder n1 n2
  291.  - procedure: modulo n1 n2
  292.      These procedures implement number-theoretic (integer) division.
  293.      N2 should be non-zero.  All three procedures return integers.  If
  294.      N1/N2 is an integer:
  295.  
  296.          (quotient N1 N2)                   ==> N1/N2
  297.          (remainder N1 N2)                  ==> 0
  298.          (modulo N1 N2)                     ==> 0
  299.  
  300.      If N1/N2 is not an integer:
  301.  
  302.          (quotient N1 N2)                   ==> N_Q
  303.          (remainder N1 N2)                  ==> N_R
  304.          (modulo N1 N2)                     ==> N_M
  305.  
  306.      where N_Q is N1/N2 rounded towards zero, 0 < |N_R| < |N2|, 0 <
  307.      |N_M| < |N2|, N_R and N_M differ from N1 by a multiple of N2, N_R
  308.      has the same sign as N1, and N_M has the same sign as N2.
  309.  
  310.      From this we can conclude that for integers N1 and N2 with N2 not
  311.      equal to 0,
  312.  
  313.           (= N1 (+ (* N2 (quotient N1 N2))
  314.                 (remainder N1 N2)))
  315.                                             ==>  #t
  316.  
  317.      provided all numbers involved in that computation are exact.
  318.  
  319.      (modulo 13 4)                          ==>  1
  320.      (remainder 13 4)                       ==>  1
  321.      
  322.      (modulo -13 4)                         ==>  3
  323.      (remainder -13 4)                      ==>  -1
  324.      
  325.      (modulo 13 -4)                         ==>  -3
  326.      (remainder 13 -4)                      ==>  1
  327.      
  328.      (modulo -13 -4)                        ==>  -1
  329.      (remainder -13 -4)                     ==>  -1
  330.      
  331.      (remainder -13 -4.0)                   ==>  -1.0  ; inexact
  332.  
  333.  
  334.  - library procedure: gcd n1 ...,
  335.  - library procedure: lcm n1 ...,
  336.      These procedures return the greatest common divisor or least common
  337.      multiple of their arguments.  The result is always non-negative.
  338.  
  339.      (gcd 32 -36)                           ==>  4
  340.      (gcd)                                  ==>  0
  341.      (lcm 32 -36)                           ==>  288
  342.      (lcm 32.0 -36)                         ==>  288.0  ; inexact
  343.      (lcm)                                  ==>  1
  344.  
  345.  
  346.  - procedure: numerator Q
  347.  - procedure: denominator Q
  348.      These procedures return the numerator or denominator of their
  349.      argument; the result is computed as if the argument was
  350.      represented as a fraction in lowest terms.  The denominator is
  351.      always positive.  The denominator of 0 is defined to be 1.
  352.  
  353.      (numerator (/ 6 4))                    ==>  3
  354.      (denominator (/ 6 4))                  ==>  2
  355.      (denominator
  356.        (exact->inexact (/ 6 4)))            ==> 2.0
  357.  
  358.  
  359.  - procedure: floor x
  360.  - procedure: ceiling x
  361.  - procedure: truncate x
  362.  - procedure: round x
  363.      These procedures return integers.  `Floor' returns the largest
  364.      integer not larger than X.  `Ceiling' returns the smallest integer
  365.      not smaller than X.  `Truncate' returns the integer closest to X
  366.      whose absolute value is not larger than the absolute value of X.
  367.      `Round' returns the closest integer to X, rounding to even when X
  368.      is halfway between two integers.
  369.  
  370.           _Rationale:_ `Round' rounds to even for consistency with the
  371.           default rounding mode specified by the IEEE floating point
  372.           standard.
  373.  
  374.           _Note:_ If the argument to one of these procedures is
  375.           inexact, then the result will also be inexact.  If an exact
  376.           value is needed, the result should be passed to the
  377.           `inexact->exact' procedure.
  378.  
  379.      (floor -4.3)                           ==>  -5.0
  380.      (ceiling -4.3)                         ==>  -4.0
  381.      (truncate -4.3)                        ==>  -4.0
  382.      (round -4.3)                           ==>  -4.0
  383.      
  384.      (floor 3.5)                            ==>  3.0
  385.      (ceiling 3.5)                          ==>  4.0
  386.      (truncate 3.5)                         ==>  3.0
  387.      (round 3.5)                            ==>  4.0  ; inexact
  388.      
  389.      (round 7/2)                            ==>  4    ; exact
  390.      (round 7)                              ==>  7
  391.  
  392.  
  393.  - library procedure: rationalize x y
  394.      `Rationalize' returns the _simplest_ rational number differing
  395.      from X by no more than Y.  A rational number r_1 is _simpler_
  396.      than another rational number r_2 if r_1 = p_1/q_1 and r_2 =
  397.      p_2/q_2 (in lowest terms) and |p_1|<= |p_2| and |q_1| <= |q_2|.
  398.      Thus 3/5 is simpler than 4/7.  Although not all rationals are
  399.      comparable in this ordering (consider 2/7 and 3/5) any interval
  400.      contains a rational number that is simpler than every other
  401.      rational number in that interval (the simpler 2/5 lies between 2/7
  402.      and 3/5).  Note that 0 = 0/1 is the simplest rational of all.
  403.  
  404.      (rationalize
  405.        (inexact->exact .3) 1/10)            ==> 1/3    ; exact
  406.      (rationalize .3 1/10)                  ==> #i1/3  ; inexact
  407.  
  408.  
  409.  - procedure: exp Z
  410.  - procedure: log Z
  411.  - procedure: sin Z
  412.  - procedure: cos Z
  413.  - procedure: tan Z
  414.  - procedure: asin Z
  415.  - procedure: acos Z
  416.  - procedure: atan Z
  417.  - procedure: atan Y X
  418.      These procedures are part of every implementation that supports
  419.      general real numbers; they compute the usual transcendental
  420.      functions.  `Log' computes the natural logarithm of Z (not the
  421.      base ten logarithm).  `Asin', `acos', and `atan' compute arcsine
  422.      (sin^-1), arccosine (cos^-1), and arctangent (tan^-1),
  423.      respectively.  The two-argument variant of `atan' computes (angle
  424.      (make-rectangular X Y)) (see below), even in implementations that
  425.      don't support general complex numbers.
  426.  
  427.      In general, the mathematical functions log, arcsine, arccosine, and
  428.      arctangent are multiply defined.  The value of log z is defined to
  429.      be the one whose imaginary part lies in the range from -pi
  430.      (exclusive) to pi (inclusive).  log 0 is undefined.  With log
  431.      defined this way, the values of sin^-1 z, cos^-1 z, and tan^-1 z
  432.      are according to the following formulae:
  433.  
  434.                    sin^-1 z = -i log (i z + sqrt1 - z^2)
  435.  
  436.                         cos^-1 z = pi / 2 - sin^-1 z
  437.  
  438.              tan^-1 z = (log (1 + i z) - log (1 - i z)) / (2 i)
  439.  
  440.      The above specification follows [CLtL], which in turn cites
  441.      [Penfield81]; refer to these sources for more detailed discussion
  442.      of branch cuts, boundary conditions, and implementation of these
  443.      functions.  When it is possible these procedures produce a real
  444.      result from a real argument.
  445.  
  446.  
  447.  - procedure: sqrt Z
  448.      Returns the principal square root of Z.  The result will have
  449.      either positive real part, or zero real part and non-negative
  450.      imaginary part.
  451.  
  452.  - procedure: expt z1 z2
  453.      Returns Z1 raised to the power Z2.  For z_1 ~= 0
  454.  
  455.                           z_1^z_2 = e^z_2 log z_1
  456.  0^z is 1 if z = 0 and 0 otherwise.
  457.  
  458.  - procedure: make-rectangular x1 x2
  459.  - procedure: make-polar x3 x4
  460.  - procedure: real-part Z
  461.  - procedure: imag-part Z
  462.  - procedure: magnitude Z
  463.  - procedure: angle Z
  464.      These procedures are part of every implementation that supports
  465.      general complex numbers.  Suppose X1, X2, X3, and X4 are real
  466.      numbers and Z is a complex number such that
  467.  
  468.                          Z = X1 + X2i = X3 . e^i X4
  469.  Then
  470.  
  471.      (make-rectangular X1 X2)               ==> Z
  472.      (make-polar X3 X4)                     ==> Z
  473.      (real-part Z)                          ==> X1
  474.      (imag-part Z)                          ==> X2
  475.      (magnitude Z)                          ==> |X3|
  476.      (angle Z)                              ==> x_angle
  477.  
  478.      where -pi < x_angle <= pi with x_angle = X4 + 2pi n for some
  479.      integer n.
  480.  
  481.           _Rationale:_ `Magnitude' is the same as `abs' for a real
  482.           argument, but `abs' must be present in all implementations,
  483.           whereas `magnitude' need only be present in implementations
  484.           that support general complex numbers.
  485.  
  486.  
  487.  - procedure: exact->inexact Z
  488.  - procedure: inexact->exact Z
  489.      `Exact->inexact' returns an inexact representation of Z.  The
  490.      value returned is the inexact number that is numerically closest
  491.      to the argument.  If an exact argument has no reasonably close
  492.      inexact equivalent, then a violation of an implementation
  493.      restriction may be reported.
  494.  
  495.      `Inexact->exact' returns an exact representation of Z.  The value
  496.      returned is the exact number that is numerically closest to the
  497.      argument.  If an inexact argument has no reasonably close exact
  498.      equivalent, then a violation of an implementation restriction may
  499.      be reported.
  500.  
  501.      These procedures implement the natural one-to-one correspondence
  502.      between exact and inexact integers throughout an
  503.      implementation-dependent range.  See section *Note Implementation
  504.      restrictions::.
  505.  
  506.  
  507.  
  508.  
  509.  
  510. 
  511. File: r5rs.info,  Node: Numerical input and output,  Prev: Numerical operations,  Up: Numbers
  512.  
  513. Numerical input and output
  514. --------------------------
  515.  
  516.  - procedure: number->string z
  517.  - procedure: number->string z radix
  518.      RADIX must be an exact integer, either 2, 8, 10, or 16.  If
  519.      omitted, RADIX defaults to 10.  The procedure `number->string'
  520.      takes a number and a radix and returns as a string an external
  521.      representation of the given number in the given radix such that
  522.  
  523.      (let ((number NUMBER)
  524.            (radix RADIX))
  525.        (eqv? number
  526.              (string->number (number->string number
  527.                                              radix)
  528.                              radix)))
  529.  
  530.      is true.  It is an error if no possible result makes this
  531.      expression true.
  532.  
  533.      If Z is inexact, the radix is 10, and the above expression can be
  534.      satisfied by a result that contains a decimal point, then the
  535.      result contains a decimal point and is expressed using the minimum
  536.      number of digits (exclusive of exponent and trailing zeroes)
  537.      needed to make the above expression true [howtoprint], [howtoread];
  538.      otherwise the format of the result is unspecified.
  539.  
  540.      The result returned by `number->string' never contains an explicit
  541.      radix prefix.
  542.  
  543.           _Note:_ The error case can occur only when Z is not a complex
  544.           number or is a complex number with a non-rational real or
  545.           imaginary part.
  546.  
  547.           _Rationale:_ If Z is an inexact number represented using
  548.           flonums, and the radix is 10, then the above expression is
  549.           normally satisfied by a result containing a decimal point.
  550.           The unspecified case allows for infinities, NaNs, and
  551.           non-flonum representations.
  552.  
  553.  
  554.  - procedure: string->number string
  555.  - procedure: string->number string radix
  556.      Returns a number of the maximally precise representation expressed
  557.      by the given STRING.  RADIX must be an exact integer, either 2, 8,
  558.      10, or 16.  If supplied, RADIX is a default radix that may be
  559.      overridden by an explicit radix prefix in STRING (e.g. "#o177").
  560.      If RADIX is not supplied, then the default radix is 10.  If STRING
  561.      is not a syntactically valid notation for a number, then
  562.      `string->number' returns #f.
  563.  
  564.      (string->number "100")                 ==>  100
  565.      (string->number "100" 16)              ==>  256
  566.      (string->number "1e2")                 ==>  100.0
  567.      (string->number "15##")                ==>  1500.0
  568.  
  569.           _Note:_ The domain of `string->number' may be restricted by
  570.           implementations in the following ways.  `String->number' is
  571.           permitted to return #f whenever STRING contains an explicit
  572.           radix prefix.  If all numbers supported by an implementation
  573.           are real, then `string->number' is permitted to return #f
  574.           whenever STRING uses the polar or rectangular notations for
  575.           complex numbers.  If all numbers are integers, then
  576.           `string->number' may return #f whenever the fractional
  577.           notation is used.  If all numbers are exact, then
  578.           `string->number' may return #f whenever an exponent marker or
  579.           explicit exactness prefix is used, or if a # appears in place
  580.           of a digit.  If all inexact numbers are integers, then
  581.           `string->number' may return #f whenever a decimal point is
  582.           used.
  583.  
  584.  
  585. 
  586. File: r5rs.info,  Node: Other data types,  Next: Control features,  Prev: Numbers,  Up: Standard procedures
  587.  
  588. Other data types
  589. ================
  590.  
  591. * Menu:
  592.  
  593. * Booleans::
  594. * Pairs and lists::
  595. * Symbols::
  596. * Characters::
  597. * Strings::
  598. * Vectors::
  599.  
  600. This section describes operations on some of Scheme's non-numeric data
  601. types: booleans, pairs, lists, symbols, characters, strings and vectors.
  602.  
  603. 
  604. File: r5rs.info,  Node: Booleans,  Next: Pairs and lists,  Prev: Other data types,  Up: Other data types
  605.  
  606. Booleans
  607. --------
  608.  
  609. The standard boolean objects for true and false are written as #t and
  610. #f.  What really matters, though, are the objects that the Scheme
  611. conditional expressions (`if', `cond', `and', `or', `do') treat as true
  612. or false.  The phrase "a true value" (or sometimes just "true") means
  613. any object treated as true by the conditional expressions, and the
  614. phrase "a false value" (or "false") means any object treated as false
  615. by the conditional expressions.
  616.  
  617. Of all the standard Scheme values, only #f counts as false in
  618. conditional expressions.  Except for #f, all standard Scheme values,
  619. including #t, pairs, the empty list, symbols, numbers, strings,
  620. vectors, and procedures, count as true.
  621.  
  622.      _Note:_ Programmers accustomed to other dialects of Lisp should be
  623.      aware that Scheme distinguishes both #f and the empty list from
  624.      the symbol `nil'.
  625.  
  626. Boolean constants evaluate to themselves, so they do not need to be
  627. quoted in programs.
  628.  
  629.  
  630.      #t                                     ==>  #t
  631.      #f                                     ==>  #f
  632.      '#f                                    ==>  #f
  633.  
  634.  - library procedure: not obj
  635.      `Not' returns #t if OBJ is false, and returns #f otherwise.
  636.  
  637.      (not #t)                               ==>  #f
  638.      (not 3)                                ==>  #f
  639.      (not (list 3))                         ==>  #f
  640.      (not #f)                               ==>  #t
  641.      (not '())                              ==>  #f
  642.      (not (list))                           ==>  #f
  643.      (not 'nil)                             ==>  #f
  644.  
  645.  
  646.  - library procedure: boolean? obj
  647.      `Boolean?' returns #t if OBJ is either #t or #f and returns #f
  648.      otherwise.
  649.  
  650.      (boolean? #f)                          ==>  #t
  651.      (boolean? 0)                           ==>  #f
  652.      (boolean? '())                         ==>  #f
  653.  
  654.  
  655. 
  656. File: r5rs.info,  Node: Pairs and lists,  Next: Symbols,  Prev: Booleans,  Up: Other data types
  657.  
  658. Pairs and lists
  659. ---------------
  660.  
  661. A "pair" (sometimes called a "dotted pair") is a record structure with
  662. two fields called the car and cdr fields (for historical reasons).
  663. Pairs are created by the procedure `cons'.  The car and cdr fields are
  664. accessed by the procedures `car' and `cdr'.  The car and cdr fields are
  665. assigned by the procedures `set-car!' and `set-cdr!'.
  666.  
  667. Pairs are used primarily to represent lists.  A list can be defined
  668. recursively as either the empty list or a pair whose cdr is a list.
  669. More precisely, the set of lists is defined as the smallest set X such
  670. that
  671.  
  672.    * The empty list is in X.
  673.  
  674.    * If LIST is in X, then any pair whose cdr field contains LIST is
  675.      also in X.
  676.  
  677.  
  678. The objects in the car fields of successive pairs of a list are the
  679. elements of the list.  For example, a two-element list is a pair whose
  680. car is the first element and whose cdr is a pair whose car is the
  681. second element and whose cdr is the empty list.  The length of a list
  682. is the number of elements, which is the same as the number of pairs.
  683.  
  684. The empty list is a special object of its own type (it is not a pair);
  685. it has no elements and its length is zero.
  686.  
  687.      _Note:_ The above definitions imply that all lists have finite
  688.      length and are terminated by the empty list.
  689.  
  690. The most general notation (external representation) for Scheme pairs is
  691. the "dotted" notation `(C1 . C2)' where C1 is the value of the car
  692. field and C2 is the value of the cdr field.  For example `(4 . 5)' is a
  693. pair whose car is 4 and whose cdr is 5.  Note that `(4 . 5)' is the
  694. external representation of a pair, not an expression that evaluates to
  695. a pair.
  696.  
  697. A more streamlined notation can be used for lists: the elements of the
  698. list are simply enclosed in parentheses and separated by spaces.  The
  699. empty list is written () .  For example,
  700.  
  701.  
  702.      (a b c d e)
  703.  
  704. and
  705.  
  706.  
  707.      (a . (b . (c . (d . (e . ())))))
  708.  
  709. are equivalent notations for a list of symbols.
  710.  
  711. A chain of pairs not ending in the empty list is called an "improper
  712. list".  Note that an improper list is not a list.  The list and dotted
  713. notations can be combined to represent improper lists:
  714.  
  715.  
  716.      (a b c . d)
  717.  
  718. is equivalent to
  719.  
  720.  
  721.      (a . (b . (c . d)))
  722.  
  723. Whether a given pair is a list depends upon what is stored in the cdr
  724. field.  When the `set-cdr!' procedure is used, an object can be a list
  725. one moment and not the next:
  726.  
  727.  
  728.      (define x (list 'a 'b 'c))
  729.      (define y x)
  730.      y                                      ==>  (a b c)
  731.      (list? y)                              ==>  #t
  732.      (set-cdr! x 4)                         ==>  _unspecified_
  733.      x                                      ==>  (a . 4)
  734.      (eqv? x y)                             ==>  #t
  735.      y                                      ==>  (a . 4)
  736.      (list? y)                              ==>  #f
  737.      (set-cdr! x x)                         ==>  _unspecified_
  738.      (list? x)                              ==>  #f
  739.  
  740. Within literal expressions and representations of objects read by the
  741. `read' procedure, the forms '<datum>, `<datum>, ,<datum>, and ,@<datum>
  742. denote two-element lists whose first elements are the symbols `quote',
  743. `quasiquote', `unquote', and `unquote-splicing', respectively.  The
  744. second element in each case is <datum>.  This convention is supported
  745. so that arbitrary Scheme programs may be represented as lists.   That
  746. is, according to Scheme's grammar, every <expression> is also a <datum>
  747. (see section *note External representation::).  Among other things,
  748. this permits the use of the `read' procedure to parse Scheme programs.
  749. See section *Note External representations::.
  750.  
  751.  - procedure: pair? obj
  752.      `Pair?' returns #t if OBJ is a pair, and otherwise returns #f.
  753.  
  754.      (pair? '(a . b))                       ==>  #t
  755.      (pair? '(a b c))                       ==>  #t
  756.      (pair? '())                            ==>  #f
  757.      (pair? '#(a b))                        ==>  #f
  758.  
  759.  
  760.  - procedure: cons obj1 obj2
  761.      Returns a newly allocated pair whose car is OBJ1 and whose cdr is
  762.      OBJ2.  The pair is guaranteed to be different (in the sense of
  763.      `eqv?') from every existing object.
  764.  
  765.      (cons 'a '())                          ==>  (a)
  766.      (cons '(a) '(b c d))                   ==>  ((a) b c d)
  767.      (cons "a" '(b c))                      ==>  ("a" b c)
  768.      (cons 'a 3)                            ==>  (a . 3)
  769.      (cons '(a b) 'c)                       ==>  ((a b) . c)
  770.  
  771.  
  772.  - procedure: car pair
  773.      Returns the contents of the car field of PAIR.  Note that it is an
  774.      error to take the car of the empty list.
  775.  
  776.      (car '(a b c))                         ==>  a
  777.      (car '((a) b c d))                     ==>  (a)
  778.      (car '(1 . 2))                         ==>  1
  779.      (car '())                              ==>  _error_
  780.  
  781.  
  782.  - procedure: cdr pair
  783.      Returns the contents of the cdr field of PAIR.  Note that it is an
  784.      error to take the cdr of the empty list.
  785.  
  786.      (cdr '((a) b c d))                     ==>  (b c d)
  787.      (cdr '(1 . 2))                         ==>  2
  788.      (cdr '())                              ==>  _error_
  789.  
  790.  
  791.  - procedure: set-car! pair obj
  792.      Stores OBJ in the car field of PAIR.  The value returned by
  793.      `set-car!' is unspecified.
  794.  
  795.      (define (f) (list 'not-a-constant-list))
  796.      (define (g) '(constant-list))
  797.      (set-car! (f) 3)                       ==>  _unspecified_
  798.      (set-car! (g) 3)                       ==>  _error_
  799.  
  800.  
  801.  - procedure: set-cdr! pair obj
  802.      Stores OBJ in the cdr field of PAIR.  The value returned by
  803.      `set-cdr!' is unspecified.
  804.  
  805.  
  806.  - library procedure: caar pair
  807.  - library procedure: cadr pair
  808.  -  :          ...
  809.  - library procedure: cdddar pair
  810.  - library procedure: cddddr pair
  811.      These procedures are compositions of `car' and `cdr', where for
  812.      example `caddr' could be defined by
  813.  
  814.      (define caddr (lambda (x) (car (cdr (cdr x))))).
  815.  
  816.      Arbitrary compositions, up to four deep, are provided.  There are
  817.      twenty-eight of these procedures in all.
  818.  
  819.  
  820.  - library procedure: null? obj
  821.      Returns #t if OBJ is the empty list, otherwise returns #f.
  822.  
  823.  
  824.  - library procedure: list? obj
  825.      Returns #t if OBJ is a list, otherwise returns #f.  By definition,
  826.      all lists have finite length and are terminated by the empty list.
  827.  
  828.              (list? '(a b c))               ==>  #t
  829.              (list? '())                    ==>  #t
  830.              (list? '(a . b))               ==>  #f
  831.              (let ((x (list 'a)))
  832.                (set-cdr! x x)
  833.                (list? x))                   ==>  #f
  834.  
  835.  
  836.  - library procedure: list OBJ ...,
  837.      Returns a newly allocated list of its arguments.
  838.  
  839.      (list 'a (+ 3 4) 'c)                   ==>  (a 7 c)
  840.      (list)                                 ==>  ()
  841.  
  842.  
  843.  - library procedure: length list
  844.      Returns the length of LIST.
  845.  
  846.      (length '(a b c))                      ==>  3
  847.      (length '(a (b) (c d e)))              ==>  3
  848.      (length '())                           ==>  0
  849.  
  850.  
  851.  - library procedure: append list ...,
  852.      Returns a list consisting of the elements of the first LIST
  853.      followed by the elements of the other LISTs.
  854.  
  855.      (append '(x) '(y))                     ==>  (x y)
  856.      (append '(a) '(b c d))                 ==>  (a b c d)
  857.      (append '(a (b)) '((c)))               ==>  (a (b) (c))
  858.  
  859.      The resulting list is always newly allocated, except that it shares
  860.      structure with the last LIST argument.  The last argument may
  861.      actually be any object; an improper list results if the last
  862.      argument is not a proper list.
  863.  
  864.      (append '(a b) '(c . d))               ==>  (a b c . d)
  865.      (append '() 'a)                        ==>  a
  866.  
  867.  
  868.  - library procedure: reverse list
  869.      Returns a newly allocated list consisting of the elements of LIST
  870.      in reverse order.
  871.  
  872.      (reverse '(a b c))                     ==>  (c b a)
  873.      (reverse '(a (b c) d (e (f))))
  874.                ==>  ((e (f)) d (b c) a)
  875.  
  876.  
  877.  - library procedure: list-tail list K
  878.      Returns the sublist of LIST obtained by omitting the first K
  879.      elements.  It is an error if LIST has fewer than K elements.
  880.      `List-tail' could be defined by
  881.  
  882.      (define list-tail
  883.        (lambda (x k)
  884.          (if (zero? k)
  885.              x
  886.              (list-tail (cdr x) (- k 1)))))
  887.  
  888.  
  889.  - library procedure: list-ref list K
  890.      Returns the Kth element of LIST.  (This is the same as the car of
  891.      (list-tail LIST K).)  It is an error if LIST has fewer than K
  892.      elements.
  893.  
  894.      (list-ref '(a b c d) 2)                 ==>  c
  895.      (list-ref '(a b c d)
  896.                (inexact->exact (round 1.8)))
  897.                ==>  c
  898.  
  899.  
  900.  - library procedure: memq obj list
  901.  - library procedure: memv obj list
  902.  - library procedure: member obj list
  903.      These procedures return the first sublist of LIST whose car is
  904.      OBJ, where the sublists of LIST are the non-empty lists returned
  905.      by (list-tail LIST K) for K less than the length of LIST.  If OBJ
  906.      does not occur in LIST, then #f (not the empty list) is returned.
  907.      `Memq' uses `eq?' to compare OBJ with the elements of LIST, while
  908.      `memv' uses `eqv?' and `member' uses `equal?'.
  909.  
  910.      (memq 'a '(a b c))                     ==>  (a b c)
  911.      (memq 'b '(a b c))                     ==>  (b c)
  912.      (memq 'a '(b c d))                     ==>  #f
  913.      (memq (list 'a) '(b (a) c))            ==>  #f
  914.      (member (list 'a)
  915.              '(b (a) c))                    ==>  ((a) c)
  916.      (memq 101 '(100 101 102))              ==>  _unspecified_
  917.      (memv 101 '(100 101 102))              ==>  (101 102)
  918.  
  919.  
  920.  - library procedure: assq obj alist
  921.  - library procedure: assv obj alist
  922.  - library procedure: assoc obj alist
  923.      ALIST (for "association list") must be a list of pairs.  These
  924.      procedures find the first pair in ALIST whose car field is OBJ,
  925.      and returns that pair.  If no pair in ALIST has OBJ as its car,
  926.      then #f (not the empty list) is returned.  `Assq' uses `eq?' to
  927.      compare OBJ with the car fields of the pairs in ALIST, while
  928.      `assv' uses `eqv?' and `assoc' uses `equal?'.
  929.  
  930.      (define e '((a 1) (b 2) (c 3)))
  931.      (assq 'a e)                            ==>  (a 1)
  932.      (assq 'b e)                            ==>  (b 2)
  933.      (assq 'd e)                            ==>  #f
  934.      (assq (list 'a) '(((a)) ((b)) ((c))))
  935.                                             ==>  #f
  936.      (assoc (list 'a) '(((a)) ((b)) ((c))))
  937.                                             ==>  ((a))
  938.      (assq 5 '((2 3) (5 7) (11 13)))
  939.                                             ==>  _unspecified_
  940.      (assv 5 '((2 3) (5 7) (11 13)))
  941.                                             ==>  (5 7)
  942.  
  943.           _Rationale:_ Although they are ordinarily used as predicates,
  944.           `memq', `memv', `member', `assq', `assv', and `assoc' do not
  945.           have question marks in their names because they return useful
  946.           values rather than just #t or #f.
  947.  
  948.  
  949. 
  950. File: r5rs.info,  Node: Symbols,  Next: Characters,  Prev: Pairs and lists,  Up: Other data types
  951.  
  952. Symbols
  953. -------
  954.  
  955. Symbols are objects whose usefulness rests on the fact that two symbols
  956. are identical (in the sense of `eqv?') if and only if their names are
  957. spelled the same way.  This is exactly the property needed to represent
  958. identifiers in programs, and so most implementations of Scheme use them
  959. internally for that purpose.  Symbols are useful for many other
  960. applications; for instance, they may be used the way enumerated values
  961. are used in Pascal.
  962.  
  963. The rules for writing a symbol are exactly the same as the rules for
  964. writing an identifier; see sections *Note Identifiers:: and *Note
  965. Lexical structure::.
  966.  
  967. It is guaranteed that any symbol that has been returned as part of a
  968. literal expression, or read using the `read' procedure, and
  969. subsequently written out using the `write' procedure, will read back in
  970. as the identical symbol (in the sense of `eqv?').  The `string->symbol'
  971. procedure, however, can create symbols for which this write/read
  972. invariance may not hold because their names contain special characters
  973. or letters in the non-standard case.
  974.  
  975.      _Note:_ Some implementations of Scheme have a feature known as
  976.      "slashification" in order to guarantee write/read invariance for
  977.      all symbols, but historically the most important use of this
  978.      feature has been to compensate for the lack of a string data type.
  979.  
  980.      Some implementations also have "uninterned symbols", which defeat
  981.      write/read invariance even in implementations with slashification,
  982.      and also generate exceptions to the rule that two symbols are the
  983.      same if and only if their names are spelled the same.
  984.  
  985.  - procedure: symbol? obj
  986.      Returns #t if OBJ is a symbol, otherwise returns #f.
  987.  
  988.      (symbol? 'foo)                         ==>  #t
  989.      (symbol? (car '(a b)))                 ==>  #t
  990.      (symbol? "bar")                        ==>  #f
  991.      (symbol? 'nil)                         ==>  #t
  992.      (symbol? '())                          ==>  #f
  993.      (symbol? #f)                           ==>  #f
  994.  
  995.  
  996.  - procedure: symbol->string symbol
  997.      Returns the name of SYMBOL as a string.  If the symbol was part of
  998.      an object returned as the value of a literal expression (section
  999.      *note Literal expressions::) or by a call to the `read' procedure,
  1000.      and its name contains alphabetic characters, then the string
  1001.      returned will contain characters in the implementation's preferred
  1002.      standard case--some implementations will prefer upper case, others
  1003.      lower case.  If the symbol was returned by `string->symbol', the
  1004.      case of characters in the string returned will be the same as the
  1005.      case in the string that was passed to `string->symbol'.  It is an
  1006.      error to apply mutation procedures like `string-set!' to strings
  1007.      returned by this procedure.
  1008.  
  1009.      The following examples assume that the implementation's standard
  1010.      case is lower case:
  1011.  
  1012.      (symbol->string 'flying-fish)
  1013.                                             ==>  "flying-fish"
  1014.      (symbol->string 'Martin)               ==>  "martin"
  1015.      (symbol->string
  1016.         (string->symbol "Malvina"))
  1017.                                             ==>  "Malvina"
  1018.  
  1019.  
  1020.  - procedure: string->symbol string
  1021.      Returns the symbol whose name is STRING.  This procedure can
  1022.      create symbols with names containing special characters or letters
  1023.      in the non-standard case, but it is usually a bad idea to create
  1024.      such symbols because in some implementations of Scheme they cannot
  1025.      be read as themselves.  See `symbol->string'.
  1026.  
  1027.      The following examples assume that the implementation's standard
  1028.      case is lower case:
  1029.  
  1030.      (eq? 'mISSISSIppi 'mississippi)
  1031.                ==>  #t
  1032.      (string->symbol "mISSISSIppi")
  1033.                ==>
  1034.        the symbol with name "mISSISSIppi"
  1035.      (eq? 'bitBlt (string->symbol "bitBlt"))
  1036.                ==>  #f
  1037.      (eq? 'JollyWog
  1038.           (string->symbol
  1039.             (symbol->string 'JollyWog)))
  1040.                ==>  #t
  1041.      (string=? "K. Harper, M.D."
  1042.                (symbol->string
  1043.                  (string->symbol "K. Harper, M.D.")))
  1044.                ==>  #t
  1045.  
  1046.  
  1047. 
  1048. File: r5rs.info,  Node: Characters,  Next: Strings,  Prev: Symbols,  Up: Other data types
  1049.  
  1050. Characters
  1051. ----------
  1052.  
  1053. Characters are objects that represent printed characters such as
  1054. letters and digits.  Characters are written using the notation
  1055. #\<character> or #\<character name>.  For example:
  1056.  
  1057.                                    
  1058.     #\a
  1059.           ; lower case letter
  1060.  
  1061.     #\A
  1062.           ; upper case letter
  1063.  
  1064.     #\(
  1065.           ; left parenthesis
  1066.  
  1067.     #\
  1068.           ; the space character
  1069.  
  1070.     #\space
  1071.           ; the preferred way to write a space
  1072.  
  1073.     #\newline
  1074.           ; the newline character
  1075.  
  1076.  
  1077.  
  1078. Case is significant in #\<character>, but not in #\<character name>.
  1079.  
  1080. If <character> in #\<character> is alphabetic, then the character
  1081. following <character> must be a delimiter character such as a space or
  1082. parenthesis.  This rule resolves the ambiguous case where, for example,
  1083. the sequence of characters "#\ space" could be taken to be either a
  1084. representation of the space character or a representation of the
  1085. character "#\ s" followed by a representation of the symbol "pace."
  1086.  
  1087. Characters written in the #\ notation are self-evaluating.  That is,
  1088. they do not have to be quoted in programs.
  1089.  
  1090. Some of the procedures that operate on characters ignore the difference
  1091. between upper case and lower case.  The procedures that ignore case
  1092. have "-ci" (for "case insensitive") embedded in their names.
  1093.  
  1094.  - procedure: char? obj
  1095.      Returns #t if OBJ is a character, otherwise returns #f.
  1096.  
  1097.  
  1098.  - procedure: char=? char1 char2
  1099.  - procedure: char<? char1 char2
  1100.  - procedure: char>? char1 char2
  1101.  - procedure: char<=? char1 char2
  1102.  - procedure: char>=? char1 char2
  1103.      These procedures impose a total ordering on the set of characters.
  1104.      It is guaranteed that under this ordering:
  1105.  
  1106.         * The upper case characters are in order.  For example,
  1107.           `(char<? #\A #\B)' returns #t.
  1108.  
  1109.         * The lower case characters are in order.  For example,
  1110.           `(char<? #\a #\b)' returns #t.
  1111.  
  1112.         * The digits are in order.  For example, `(char<? #\0 #\9)'
  1113.           returns #t.
  1114.  
  1115.         * Either all the digits precede all the upper case letters, or
  1116.           vice versa.
  1117.  
  1118.         * Either all the digits precede all the lower case letters, or
  1119.           vice versa.
  1120.  
  1121.  
  1122.      Some implementations may generalize these procedures to take more
  1123.      than two arguments, as with the corresponding numerical predicates.
  1124.  
  1125.  
  1126.  - library procedure: char-ci=? char1 char2
  1127.  - library procedure: char-ci<? char1 char2
  1128.  - library procedure: char-ci>? char1 char2
  1129.  - library procedure: char-ci<=? char1 char2
  1130.  - library procedure: char-ci>=? char1 char2
  1131.      These procedures are similar to `char=?' et cetera, but they treat
  1132.      upper case and lower case letters as the same.  For example,
  1133.      `(char-ci=? #\A #\a)' returns #t.  Some implementations may
  1134.      generalize these procedures to take more than two arguments, as
  1135.      with the corresponding numerical predicates.
  1136.  
  1137.  
  1138.  - library procedure: char-alphabetic? char
  1139.  - library procedure: char-numeric? char
  1140.  - library procedure: char-whitespace? char
  1141.  - library procedure: char-upper-case? letter
  1142.  - library procedure: char-lower-case? letter
  1143.      These procedures return #t if their arguments are alphabetic,
  1144.      numeric, whitespace, upper case, or lower case characters,
  1145.      respectively, otherwise they return #f.  The following remarks,
  1146.      which are specific to the ASCII character set, are intended only
  1147.      as a guide:  The alphabetic characters are the 52 upper and lower
  1148.      case letters.  The numeric characters are the ten decimal digits.
  1149.      The whitespace characters are space, tab, line feed, form feed,
  1150.      and carriage return.
  1151.  
  1152.  - procedure: char->integer char
  1153.  - procedure: integer->char N
  1154.      Given a character, `char->integer' returns an exact integer
  1155.      representation of the character.  Given an exact integer that is
  1156.      the image of a character under `char->integer', `integer->char'
  1157.      returns that character.  These procedures implement
  1158.      order-preserving isomorphisms between the set of characters under
  1159.      the `char<=?' ordering and some subset of the integers under the
  1160.      `<=' ordering.  That is, if
  1161.  
  1162.      (char<=? A B) => #t  and  (<= X Y) => #t
  1163.  
  1164.      and X and Y are in the domain of `integer->char', then
  1165.  
  1166.      (<= (char->integer A)
  1167.          (char->integer B))                 ==>  #t
  1168.      
  1169.      (char<=? (integer->char X)
  1170.               (integer->char Y))            ==>  #t
  1171.  
  1172.  
  1173.  - library procedure: char-upcase char
  1174.  - library procedure: char-downcase char
  1175.      These procedures return a character CHAR2 such that `(char-ci=?
  1176.      CHAR CHAR2)'.  In addition, if CHAR is alphabetic, then the result
  1177.      of `char-upcase' is upper case and the result of `char-downcase'
  1178.      is lower case.
  1179.  
  1180.  
  1181.